package com.my.spring.boot.ctrl;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.my.spring.boot.entiy.User;
import com.my.spring.boot.service.UserService;

public class UserController {

	private Logger logger = Logger.getLogger(UserController.class);
	 
    @Autowired
    private UserService userService;
 
    /*
     *  http://localhost:8080/getUserInfo
     */
 
    @RequestMapping("/getUserInfo")
    @ResponseBody
    public List<User> getUserInfo() {
        List<User> user = userService.getUser();
        if(user!=null){
            System.out.println("user.getName():"+user.size());
            logger.info("user.getAge():"+user.size());
        }
        return user;
    }
}
